home *** CD-ROM | disk | FTP | other *** search
/ Aminet 20 / Aminet 20 (1997)(GTI - Schatztruhe)[!][Aug 1997].iso / Aminet / dev / src / DICE_SharedLib.lha / test.c < prev   
C/C++ Source or Header  |  1997-06-23  |  2KB  |  77 lines

  1. //
  2. //        Example Shared Library Code
  3. //        Compiles with DICE
  4. //        
  5. //        By Wez Furlong <wez@twinklestar.demon.co.uk>
  6. //
  7. //        Based on code by Geert Uytterhoeven and Matt Dillon
  8. //
  9. //        This source was produced:    Monday 23-Jun-1997 
  10. //
  11. //        DISCLAIMER
  12. //
  13. //        Please read the code FULLY before use... I could have put ANYTHING in
  14. //        here; I may have the code format your bootdrive for example.
  15. //
  16. //        NEVER trust example code without fully understanding what it does.
  17. //
  18. //        This code comes with no warranty; I am NOT responsible for any damage
  19. //        that may ensue from its use, be it physical, mental or otherwise.
  20. //
  21. //        This code may be modified, so long as the names of myself, Geert and
  22. //        Matt are mentioned within any release or distribution produced using it,
  23. //        and a copy sent to myself.
  24. //
  25. //        This code may be redistributed freely; no profit is allowed to be made
  26. //        from its distribution.
  27. //
  28. //        This code may be included on an Aminet or Fred Fish CD.
  29. //
  30.  
  31. //        Test Code:    Just to make sure it all works :)
  32.  
  33. //        To build:    dcc -Iobjects/ test.c
  34. //            run dmake first though; you will need a library to open :)
  35.  
  36. #include "example.h"
  37.  
  38. #include "example_pragmas.h"
  39.  
  40. LONG main(int ac, char **av[])
  41. {
  42.     struct LibraryBase *LibraryBase;
  43.  
  44.     if (LibraryBase = (struct LibraryBase*)OpenLibrary("distribution/example.library",39))
  45.     {
  46.         char buf[20];
  47.         
  48.         puts((STRPTR)"Posting 'wibble'");
  49.         PostString((STRPTR)"wibble");
  50.         puts((STRPTR)"Posting 'wobble'");
  51.         PostString((STRPTR)"wobble");
  52.         puts((STRPTR)"Posting 'spoink'");
  53.         PostString((STRPTR)"spoink");
  54.         puts((STRPTR)"\nRecalling strings...");
  55.         
  56.         GetString((STRPTR)&buf, 20);
  57.         puts((STRPTR)&buf);
  58.         
  59.         GetString((STRPTR)&buf, 20);
  60.         puts((STRPTR)&buf);
  61.  
  62.         GetString((STRPTR)&buf, 20);
  63.         puts((STRPTR)&buf);
  64.  
  65.         puts((STRPTR)"\nDone.\nClosing Library");
  66.  
  67.         CloseLibrary((struct Library*)LibraryBase);
  68.     }
  69.     else
  70.     {
  71.         puts((STRPTR)"Unable to open the library!!");
  72.         exit(20);
  73.     }
  74.     exit(0);
  75. }
  76.  
  77.